C# Fibonacci list

39

C# Fibonacci list -

static IEnumerable<int> Fibonacci()
{
    int current = 1, next = 1;

    while (true)
    {
        yield return current;
        next = current + (current = next);
    }
}

Comments

Submit
0 Comments